package com.cardbaobao.cardbabyclient.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.cardbaobao.cardbabyclient.R;
import com.cardbaobao.cardbabyclient.buried.Self;
import com.cardbaobao.cardbabyclient.buried.SelfUtils;
import com.cardbaobao.cardbabyclient.ui.activity.base.BaseActivity;
import com.cardbaobao.cardbabyclient.buried.GoogleAnalyticsUtil;
import com.cardbaobao.cardbabyclient.widget.TitleBar;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by Jiangzx on 2017/9/16 15:26.
 */

public class AddCreditCardPreActivity extends BaseActivity {
    @BindView(R.id.title_bar)
    TitleBar titleBar;

    private String name;
    private String idCardNo;
    @Override
    protected int getLayoutId() {
        return R.layout.activity_add_credit_card_pre;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        super.initView(savedInstanceState);
        titleBar.setLeftViewOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        super.initData(savedInstanceState);
        Intent intent=getIntent();

        mCurrentPageId=Self.Page.app_no_credit_cards_added;

        name=intent.getStringExtra(AddCreditCardActivity.NAME_S);
        idCardNo=intent.getStringExtra(AddCreditCardActivity.ID_CARD_NO_S);
    }

    @Override
    protected void onResume() {
        super.onResume();
        GoogleAnalyticsUtil.setScreenName("添加信用卡提示");
    }

    @OnClick(R.id.bt_add_credit_card)
    public void onClick(View view){
        switch (view.getId()){
            case R.id.bt_add_credit_card:
                //去添加信用卡
                //埋点
                SelfUtils.buriedClickData(Self.Action.app_click_no_credit_cards_added_goadd,
                        Self.Action.app_click_no_credit_cards_added_goadd_des,
                        mEnterPageTime,
                        mCurrentPageId,
                        mPrePageId);

                initIntent();
                mIntent.setClass(this,AddCreditCardActivity.class);
                mIntent.putExtra(AddCreditCardActivity.NAME_S,name);
                mIntent.putExtra(AddCreditCardActivity.ID_CARD_NO_S,idCardNo);
                mIntent.putExtra(AddCreditCardActivity.PAGE_FROM_I,
                        AddCreditCardActivity.PAGE_QUICK_DEBIT);
                mIntent.putExtra(PRE_PAGE_ID_S,mCurrentPageId);
                startActivity(mIntent);
                finish();
                break;
        }
    }
}
